<template>
	<yd-layout id='leaderHeart' class=''>
		<div class="content">
			<img class="header_img" :src="leaderObj.avatar" alt="" />
			<div class="name">{{leaderObj.nick_name}}</div>
			<div class="textarea">
				<textarea  class="c_size_30_42" name="" v-model.trim="inputVal" placeholder="写下你想对我倾诉的话语~" rows="" cols=""></textarea>
			</div>
			<div class="btn" @click="submitHeart">发送心声</div>
		</div>
	</yd-layout>
</template>

<script>
	export default{
		components:{
			
		},
		data(){
			return {
				leaderObj:{},
				inputVal:''
			}
		},
		created() {
		},
		watch: {
			
		},
		computed: {
			
		},
		mounted(){
			document.title='倾诉心声'
			this.leaderDetail()
		},
		methods:{
			submitHeart(){
				if(this.inputVal){
					this.$root.ajax({
						name:'comment/doComment',
						params:{
							kind:4,
							oid:this.$route.query.uid,
							content:this.inputVal
						}
					}).then((d)=>{
						sessionStorage.setItem('wst_isShare',1)
						this.$router.go(-1)
//						this.$dialog.toast({
//		                    mes: '倾诉成功',
//		                    timeout: 1500,
//		                    icon: 'success',
//		                    callback: () => {
//		                    	//这样写的好处是不用生成history
//		                    	
//		                    }
//		                });
					})
				}else{
					this.$dialog.toast({
	                    mes: `请输入内容`,
	                    timeout: 1500,
	                });
				}
					
			},
			//领袖详情
			leaderDetail(){
				this.$root.ajax({
					name:'leader/detail',
					type:'get',
					params:{
						id:this.$route.query.id
					}
				}).then((d)=>{
					this.leaderObj=Object.assign({},this.leaderObj,d.data.leader)
				})
			},
		}
	}
</script>

<style lang="scss">
	@import './leaderHeart.scss';
</style>